
package com.thinkgem.jeesite.common.pojo.runtime;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;



public class ClassFields {
	
	public ClassFields(Class<?> clazz) {
	    setClazz(clazz);
	    setsFields(getClassFields(getClazz()));
	    setaFields(getsFields().split(","));
	    setlFields(Arrays.asList(getaFields()));
    }

	public Class<?> getClazz() {
		return clazz;
	}

	public void setClazz(Class<?> clazz) {
		this.clazz = clazz;
	}

	public String getsFields() {
		return sFields;
	}

	public void setsFields(String sFields) {
		this.sFields = sFields;
	}

	public String[] getaFields() {
		return aFields;
	}

	public void setaFields(String[] aFields) {
		this.aFields = aFields;
	}

	public List<String> getlFields() {
		return lFields;
	}

	public void setlFields(List<String> lFields) {
		this.lFields = lFields;
	}

	public static String getClassFields(Class<?> clazz) {
		String str = "";
		for (Field fd : clazz.getFields()) {
			str += fd.getName() + ",";
		}
		return str.substring(0, str.lastIndexOf(","));
	}

	private Class<?> clazz;
	private String sFields;
	private String[] aFields;
	private List<String> lFields;
}
